<?php
namespace app\api\controller;
vendor('Qiniu.autoload');
use Qiniu\Auth as Auth;
use Qiniu\Storage\BucketManager;
use Qiniu\Storage\UploadManager;
class Qiniu extends Permission
{
    public function getToken()
    {
        $config = \config('qiniu'); //获取配置信息
        $accessKey = $config['accessKey'];
        $secretKey = $config['secretKey'];
        $auth = new Auth($accessKey, $secretKey);
        $bucket = $config['bucket'];
        // 生成上传Token
        $token = $auth->uploadToken($bucket);

        $data = [
            'token' => $token,
            'uploadUrl' => 'https://upload-z2.qiniup.com',
            'imagesUrl' => 'http://btsj.images.zrjt4000602666.com/'
        ];
        $this->resSuc($data);

    }

}
